package com.piggy.logi.sys.api;

import com.piggy.common.core.constant.SecurityConstants;
import com.piggy.common.core.constant.ServiceNameConstants;
import com.piggy.common.core.domain.R;
import com.piggy.logi.sys.api.domain.LogiSysRole;
import com.piggy.logi.sys.api.domain.LogiSysUser;
import com.piggy.logi.sys.api.factory.RemoteLogiRoleFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 角色服务
 *
 * @author shark
 */
@FeignClient(contextId = "remoteLogiRoleService", value = ServiceNameConstants.SYSTEM_LOGI_SERVICE, fallbackFactory = RemoteLogiRoleFallbackFactory.class)
public interface RemoteLogiRoleService {

    /**
     * 删除角色
     */
    //@SaCheckPermission("system:role:remove")
    @PostMapping("/logi/role/inner/{roleIds}")
    public R innerRemove(@PathVariable(value = "roleIds") Long[] roleIds, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/logi/role/inner/getRoleByKey/{roleKey}")
    public R<LogiSysRole> getRoleByKey(@PathVariable(value = "roleKey") String roleKey, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/logi/role/inner/getRoleUser/{roleId}")
    public R<List<LogiSysUser>> getRoleUsers(@PathVariable(value = "roleId") Long roleId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 新增角色
     */
    //@SaCheckPermission("system:role:add")
    @PostMapping("/logi/role/inner/add")
    public R innerAdd(@Validated @RequestBody LogiSysRole role, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 修改保存角色
     */
    //@SaCheckPermission("system:role:edit")
    @PutMapping("/logi/role/inner/edit")
    public R innerEdit(@Validated @RequestBody LogiSysRole role, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 修改保存数据权限
     */
    //@SaCheckPermission("system:role:edit")
    @PutMapping("/logi/role/inner/dataScope")
    public R innerDataScope(@RequestBody LogiSysRole role, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 状态修改
     */
    //@SaCheckPermission("system:role:edit")
    @PutMapping("/logi/role/inner/changeStatus")
    public R innerChangeStatus(@RequestBody LogiSysRole role, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping("/logi/role/inner/queryRoleAll/{mainDeptId}")
    R<List<LogiSysRole>> queryRoleAll(@PathVariable(value = "mainDeptId") Long mainDeptId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/logi/role/inner/getById/{roleId}")
    public R<LogiSysRole> getById(@PathVariable(value = "roleId") Long roleId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

}
